window.onload=function () {
    document.getElementById("name").focus();
    if(document.getElementById("contact")!==null){
        document.getElementById("contact").onsubmit=function () {
            var sname=document.getElementById("name").value;
            var sdzyj=document.getElementById("email").value;
            var stelephone=document.getElementById("telephone").value;
            var scompany=document.getElementById("company").value;
            var ssex=document.getElementsByName("sex");
            for(var iCv=0;iCv<ssex.length;iCv++){
                if(ssex.item(iCv).checked){
                ssex=ssex.item(iCv).value;
                }
            }
            var sage=document.getElementById("age");
            var oage=sage.options[sage.selectedIndex].firstChild.nodeValue;
            //     =function () {
            //     // sage.alert(sage.options[0].firstChild.nodeValue);
            // }

            // for(iCv=0;iCv<sage.options.length;iCv++){
            //     if(sage.options[iCv].selected){
            //         sage=sage.options[iCv].firstChild.nodeValue;
            //     }
            // }
            var sinterest="";
            var ointerest=document.getElementsByName("interest");
            for (icv=0;icv<ointerest.length;icv++){
                if(ointerest.item(icv).checked){
                    sinterest+=ointerest.item(icv).value;
                }
            }
            document.getElementById("message").style.visibility="visible";
            document.getElementById("submitmessage").innerHTML="<strong> 姓名："+sname+"<br>性别："+
                ssex+"<br>年龄范围:"+oage+"<br>爱好："+sinterest+"<br>电子邮件："+sdzyj+"<br>固定电话："+
                stelephone+"<br>公司："+scompany+"</strong>";
            return false;
        }
    }
}